﻿<%@ Page Title="" Language="C#" Theme = "DetailsView" MasterPageFile="~/Managers.master" AutoEventWireup="true" CodeFile="MStudentsSearch.aspx.cs" Inherits="MStudentsSearch" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:TextBox 
         ID = "txtsid"
         runat = "server" ></asp:TextBox>
    <asp:Button 
         ID = "btnSubmit"
         Text = "学号查询 "
         OnClick = "btnSubmit_Click"
         runat = "server" />
    <hr />
    <asp:DetailsView 
         ID = "dtlStudents"
         SkinID = "Colorful"
         DataSourceID = "srcStudents"
         EmptyDataText = "没有这个学生"
         HeaderText = "个人信息"
         Visible = "false"
         DataKeyNames = "sid"
         AutoGenerateEditButton = "true"
         AutoGenerateDeleteButton = "true"
         AutoGenerateRows = "false"
         runat = "server">
         <Fields>
         <asp:BoundField 
             DataField = "sid"
             HeaderText = "学号" />
        <asp:BoundField 
             DataField ="sname"
             HeaderText = "姓名" />
        <asp:BoundField 
             DataField = "ssex"
             HeaderText = "性别" />
        <asp:BoundField 
             DataField = "academy"
             HeaderText = "学院 " />
        <asp:BoundField 
             DataField =  "grade"
             HeaderText = "年级" />
        <asp:BoundField 
             DataField =  "class"
             HeaderText = "班级" />
        <asp:BoundField 
             DataField =  "password"
             HeaderText = "密码" />
        <asp:BoundField 
             DataField =  "b_n"
             HeaderText = "楼号" />
        <asp:BoundField 
             DataField =  "d_n"
             HeaderText = "宿舍号" />
        <asp:BoundField 
             DataField =  "contactway"
             HeaderText = "联系方式" />
        <asp:BoundField 
             DataField =  "moveintime"
             HeaderText = "入住时间" />
         </Fields>
    </asp:DetailsView>
    <asp:SqlDataSource 
         ID = "srcStudents"
         ConnectionString = "<%$ConnectionStrings:Dormitory %>"
         SelectCommand = "select sid,sname,ssex,academy,grade,class,password,b_n,
         d_n,contactway,moveintime from students where sid like @sid+'%'"
         UpdateCommand = "update students set sname = @sname,ssex = @ssex,
         academy = @academy,grade = @grade,class=@class,password = @password,b_n=@b_n,
         d_n = @d_n,contactway = @contactway,moveintime = @moveintime where sid=@sid"
         DeleteCommand = "delete from students where sid = @sid"
         runat = "server" >
         <SelectParameters >
         <asp:ControlParameter 
             Name = "sid"
             ControlID = "txtsid"
             PropertyName = "Text" />
         </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>

